package com.bitinstitute.parkapp.wallpaper;

import com.bitinstitute.parkapp.R;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.ImageView;

public class ImageAdapter extends BaseAdapter {
	private Context mContext;
	
	// Keep all Images in array
	public Integer[] mThumbIds = {
			R.drawable.wallpaper_1, R.drawable.wallpaper_2, R.drawable.wallpaper_3, 
			R.drawable.wallpaper_4,	R.drawable.wallpaper_5, R.drawable.wallpaper_1, 
			R.drawable.wallpaper_2, R.drawable.wallpaper_3, R.drawable.wallpaper_4, 
			R.drawable.wallpaper_5, R.drawable.wallpaper_1, R.drawable.wallpaper_2,
			R.drawable.wallpaper_3, R.drawable.wallpaper_4,	R.drawable.wallpaper_5, 
			R.drawable.wallpaper_1, R.drawable.wallpaper_2, R.drawable.wallpaper_3, 
			R.drawable.wallpaper_4, R.drawable.wallpaper_5, R.drawable.wallpaper_1, 
			R.drawable.wallpaper_2, R.drawable.wallpaper_3, R.drawable.wallpaper_4, 
			R.drawable.wallpaper_5, R.drawable.wallpaper_1, R.drawable.wallpaper_2,
			R.drawable.wallpaper_1, R.drawable.wallpaper_2, R.drawable.wallpaper_3, 
			R.drawable.wallpaper_4,	R.drawable.wallpaper_5, R.drawable.wallpaper_1, 
			R.drawable.wallpaper_2, R.drawable.wallpaper_3, R.drawable.wallpaper_4, 
			R.drawable.wallpaper_5, R.drawable.wallpaper_1, R.drawable.wallpaper_2,
			R.drawable.wallpaper_3, R.drawable.wallpaper_4,	R.drawable.wallpaper_5, 
			R.drawable.wallpaper_1, R.drawable.wallpaper_2, R.drawable.wallpaper_3, 
			R.drawable.wallpaper_4, R.drawable.wallpaper_5, R.drawable.wallpaper_1, 
			R.drawable.wallpaper_2, R.drawable.wallpaper_3, R.drawable.wallpaper_4, 
			R.drawable.wallpaper_5, R.drawable.wallpaper_1, R.drawable.wallpaper_2,
	};
	
	// Constructor
	public ImageAdapter(Context c){
		mContext = c;
	}

	public int getCount() {
		return mThumbIds.length;
	}

	public Object getItem(int position) {
		return mThumbIds[position];
	}

	public long getItemId(int position) {
		return 0;
	}

	public View getView(int position, View convertView, ViewGroup parent) {			
		ImageView imageView = new ImageView(mContext);
        imageView.setImageResource(mThumbIds[position]);
        imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
        imageView.setLayoutParams(new GridView.LayoutParams(70, 70));
        return imageView;
	}

}
